<?php

function printNews($new_description, $new_name, $type_img, $id_news, $heure) {

    switch ($type_img) {
        case 0 :
            $ext = 'png';
            break;
        case 1 :
            $ext = 'jpg';
            break;
        case 2 :
            $ext = 'jpeg';
            break;
        default :
            $ext = '';
            break;
    }

    echo '<div id="new">
                <span id="new_title"> ';
             if (preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])) { //pour détecter si le navigateur est IE
        echo' ' . utf8_decode(stripslashes( $new_name) ) . '';
    } else { //les autres navigateurs 
        echo' ' . stripslashes( $new_name) . ' ';
    }
     echo '</span> <span class="hour">   le '.date("d/m/Y", strtotime($heure)) .'</span>';
    echo'  </br></br>
                <img id="img_new" src="' . URL_IMG . 'news/' . $id_news . '.jpeg" alt="' . $new_name . '" />
                <span id="new_box">
                    <span id="new_description"> ' . $new_description . '  </span>
                </span>
            </div>
            ';
}
function  print_video($new_description, $new_name, $type_img, $new_id, $heure)
{
  echo'<div id="new">
      <span>
                <span id="new_title"> ' ;
  if (preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])) { //pour détecter si le navigateur est IE
        echo' ' . utf8_decode(stripslashes( $new_name) ) . '';
    } else { //les autres navigateurs 
        echo' ' . stripslashes( $new_name) . ' ';
    }
    $date = new DateTime($heure);
/*
Le paramétre $affiche indique si la date est affichée directement ou juste pour avoir sa valeur
*/
	//echo $date->format('d-m-Y');

    echo '</span> <span class="hour">   le '. $date->format('d-m-Y') .'</span>';
    // echo '</span> <span class="hour">   le '.date("d/m/Y", strtotime($heure)) .'</span>';
    
   // echo $date->format('d-m-Y H:i:s');
    
  
  echo'</br></br>
                    <video id="video_new" class="video-js vjs-default-skin" controls preload="none"  data-setup="{}">
                      <source src="' . URL_IMG . 'news/' . $new_id . '.webm" type="video/webm" />
                      <track kind="captions" src="demo.captions.vtt" srclang="en" label="English" />
                    </video>
                    
                <span id="new_description"> ' . $new_description . '  </span>
            </span>
            </div>
            ';
   echo' ';
   

}

?>
